<template>
  <div class="main">
    <div class="inner">
      <el-row>
        <el-col :md="12" :xs="24">
          <div class="leftCont wow slideInLeft">
            <div class="head">
              <h1>{{ $t('ismsg.about.title') }}</h1>
              <h2>{{ $t('ismsg.title') }}</h2>
              <p class="subtitle fs-18">{{ $t('ismsg.about.subtitle') }}</p>
            </div>
            <p class="title fs-14">{{ $t('ismsg.about.text') }}</p>
            <p class="text fs-12">{{ $t('ismsg.about.addresses') }}</p>
            <div class="link" v-if="isMobile()">{{ formatAddr(mainStore.baseData?.axieContractAddress,15) }}</div>
            <div class="link" v-else>{{ mainStore.baseData?.axieContractAddress }}</div>
            <div class="btnGroups">
              <div class="btn" @click="copy(mainStore.baseData?.axieContractAddress)">
                <span>{{ $t('ismsg.about.btns[0]') }} </span>
                <i class="iconfont icon-fuzhi"></i>
              </div>
              <a
                :href="`https://bscscan.com/address/${mainStore.baseData?.axieContractAddress}`"
                target="_blank"
                rel="noopener noreferrer">
                <div class="btn">
                  <span>{{ $t('ismsg.about.btns[1]') }}</span>
                  <i class="iconfont icon-lianjie"></i>
                </div>
              </a>
            </div>
          </div>
        </el-col>
        <el-col :md="12" :xs="24">
          <div class="rightCont wow slideInRight">
            <img src="@/assets/images/about2.png" alt="" />
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { ElMessage } from 'element-plus';
import { formatAddr,isMobile } from '@/utils/common';
import { useI18n } from 'vue-i18n';
import { useMainStore } from '@/store/index';

const mainStore = useMainStore();
const { t: lang } = useI18n();

const copy = (val: string) => {
  const input = document.createElement('input'); //创建input
  input.setAttribute('value', val); //把input设置value
  document.body.appendChild(input); //添加这个dom对象
  input.select(); //选中该输入框
  document.execCommand('copy'); //复制该文本
  document.body.removeChild(input); //移除输入框
  ElMessage.success(lang('ismsg.tips.copy'));
};
</script>

<style lang="scss" scoped>
.main {
  padding-bottom: 8vh;
  position: relative;
  background-color: rgba(7, 25, 75, 1);
}

.inner {
  width: 80%;
  padding: 5% 3%;
  margin: 0 auto;
  background: url('@/assets/images/whiteBg.png') no-repeat left top;
  background-size: 100% 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 9;

  .leftCont {
    width: 90%;
    margin: 0 auto;
    position: relative;

    .head {
      font-family: MFBanHei_Noncommercial-Regular;

      h1 {
        font-size: 40px;
        font-weight: 700;
        background-image: linear-gradient(to bottom, #f99b36, #f35845);
        -webkit-background-clip: text;
        color: transparent;
      }

      h2 {
        font-size: 63px;
        font-weight: 700;
        letter-spacing: 4px;
        background-image: linear-gradient(to bottom, #11bad3, #4da7f7);
        -webkit-background-clip: text;
        color: transparent;
        margin: 1vh 0;
      }

      .subtitle {
        font-size: 34px;
        background-image: linear-gradient(to bottom, #11bad3, #4da7f7);
        -webkit-background-clip: text;
        color: transparent;
      }
    }

    .title {
      font-size: 22px;
      color: #572815;
      margin: 1vh 0;
    }

    .text {
      font-size: 18px;
      color: #572815;
    }

    .link {
      padding: 1vh 20px;
      height: 32px;
      margin-top: 1vh;
      text-align: center;
      background-color: #ffffff;
      box-shadow: inset 0px 0px 5px 0px rgba(4, 0, 0, 0.24);
      border-radius: 16px;
    }

    .btnGroups {
      .btn {
        padding: 1vh 1vw;
        font-size: 15px;
        color: #572815;
        font-weight: 600;
        background-color: #ffffff;
        font-family: MFBanHei_Noncommercial-Regular;
        box-shadow: 0px 3px 16px 0px rgba(116, 55, 46, 0.11);
        border-radius: 20px;
        cursor: pointer;

        i {
          margin-left: 0.5vw;
          color: #ff8244;
        }
      }
    }
  }

  .rightCont {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;

    img {
      width: 100%;
      max-width: 526px;
    }
  }
}

@media screen and (min-width: 992px) {
  .leftCont {
    .link {
      width: 80%;
    }

    .btnGroups {
      width: 80%;
      display: flex;
      justify-content: space-between;
      margin-top: 3vh;
    }
  }
}

@media screen and (max-width: 992px) {
  .leftCont {
    .btnGroups {
      position: absolute;
      top: 10vh;
      right: 0;
      z-index: 9;
      display: block;

      .btn {
        display: table;

        &:last-of-type {
          margin-top: 3vh;
        }
      }
    }
  }

  .rightCont {
    margin-top: 1vh;
  }
}

@media screen and (max-width: 768px) {
  .main {
    padding-bottom: 5vh;
  }

  .inner {
    width: 90%;
    padding: 8% 3%;
    border-radius: 20px;
    overflow: hidden;

    .leftCont {
      width: 100%;

      .head {
        h1 {
          font-size: 28px;
        }

        h2 {
          font-size: 36px;
          margin: 0;
        }

        .subtitle {
          font-size: 26px;
        }
      }

      .title {
        margin: 0;
      }

      .btnGroups {
        width: 100%;
        display: flex;
        justify-content: space-between;
        position: initial;
        margin-top: 1.5vh;

        .btn {
          padding: 6px 15px;
          font-size: 12px;

          &:last-of-type {
            margin-top: 0;
          }
        }
      }
    }

    .rightCont img {
      width: 80%;
    }
  }
}
</style>
